magic
magic(input: Number) : Mat
param input
- the number being the size of the square magic matrix. If input = 4, it'll generate a 4x4 magic matrix.
returns: Mat
- a Mat of size input x input, with the magic properties imbued making it a magic matrix.
This function creates a magic matrix given a number, the size of the matrix to make. A magic matrix is one where the rows, columns, and main diagonals sum up to the same values. Naturally, the matrix is square. An example is given in the section below. Try it out for different inputs.